import CheckBox from "../../../../prefabs/check_box";
import BulletAttrItem from "./bullet_attr_item";

const { ccclass, property } = cc._decorator;

@ccclass
export default class BulletAttrItemVec2 extends BulletAttrItem {
    @property(CheckBox)
    cb: CheckBox = null;
    protected onLoad(): void {
        this.cb.on("clicked", this.onEdit, this);
    }
    setVal(key: string, val: boolean) {
        this.lbKey.string = key;
        this.cb.checked = val;
        this.diffNode.active = false;
    }
    setValAdditive(key: string, val: any) {
        this.lbKey.string = key;
        if (this.cb.checked === val) {
            this.diffNode.active = false;
        }
        else {
            this.diffNode.active = true;
        }
    }
    onEdit() {
        this.emit("edit", this.cb.checked);
    }
};